Dynomotion

Group: DynoMotion Message: 12141 From: embraced338 Date: 8/22/2015
Subject: Relative movement in KMotionCNC

Hi all,


I've got a touch plate I'm using for Z height probing, and am having some difficulty understanding how to execute relative movements in KMotionCNC to use this effectively.


What I would like to do is this: 

  • Jog Z axis down slowly until the input is high
  • Once input is high, set the KMotionCNC DRO (relative or G54) to the probe height (47.5mm)
  • Move Z axis up some arbitrary amount so I can retrieve the probe

I have this code working, albeit it does not set the DRO height or move the Z axis positive.
------------------------------
#include "KMotionDef.h"

//probing routine for DT-02 touch probe

main()
{

EnableAxis(2);

Jog(2,-2000);             // jog Z axis slowly negative
    while (!ReadBit(1031)) ;  // loop until IO bit goes high
    Jog(2,0); // stop
    while (!CheckDone(2)) ; // loop until motion completes
DisableAxis(2); // disable the axis
// insert Z offset code here
    EnableAxis(2);
// insert relative move here

}

----------------------------------


Some help filling these blanks would help.


Thanks,

Lindsay
Group: DynoMotion Message: 12142 From: TK Date: 8/22/2015
Subject: Re: Relative movement in KMotionCNC
Hi Lindsay,

See the example:
\C Programs\KFLOPtoPCCmdExamples.c

Specifically the SET_Z command.

    DoPCFloat(PC_COMM_SET_Z,1.25);

There shouldn't be any need to enable/disable the axis. 

You can do a relative move with something like a MoveRel(2,1000.0);

HTH
Regards
TK

On Aug 22, 2015, at 7:53 PM, embraced338@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:

 

Hi all,


I've got a touch plate I'm using for Z height probing, and am having some difficulty understanding how to execute relative movements in KMotionCNC to use this effectively.


What I would like to do is this: 

  • Jog Z axis down slowly until the input is high
  • Once input is high, set the KMotionCNC DRO (relative or G54) to the probe height (47.5mm)
  • Move Z axis up some arbitrary amount so I can retrieve the probe

I have this code working, albeit it does not set the DRO height or move the Z axis positive.
------------------------------
#include "KMotionDef.h"

//probing routine for DT-02 touch probe

main()
{

EnableAxis(2);

Jog(2,-2000);             // jog Z axis slowly negative
    while (!ReadBit(1031)) ;  // loop until IO bit goes high
    Jog(2,0); // stop
    while (!CheckDone(2)) ; // loop until motion completes
DisableAxis(2); // disable the axis
// insert Z offset code here
    EnableAxis(2);
// insert relative move here

}

----------------------------------


Some help filling these blanks would help.


Thanks,

Lindsay